package com.yhy.wxzn.wcs.wcsWmsCommunication.bean;


import com.yhy.wxzn.common.utils.DateUtil;
import lombok.Data;

import java.util.Date;


@Data
public class TaskStatusRtn {

    /**
     *  taskId :  id123
     *  reportTime : 2020-07-14 02:51:33.379
     *  taskStatus : 1
     *  reportInfo  : 失败原因：……
     */

    private String taskId;
    private String reportTime;
    private int taskStatus;
    private String reportInfo;
    private String gridId;

    public static TaskStatusRtn buildTaskStatusRtn(String wmsTaskId, WmsTaskStatus wmsTaskStatus){
        TaskStatusRtn taskStatusRtn = new TaskStatusRtn();
        taskStatusRtn.setTaskId(wmsTaskId);
        taskStatusRtn.setTaskStatus(wmsTaskStatus.getTaskProgress());
        taskStatusRtn.setReportTime(DateUtil.format(new Date(),DateUtil.YMDHMS));
        return taskStatusRtn;
    }

    public static TaskStatusRtn buildTaskStatusRtn(String wmsTaskId, String endGridId, WmsTaskStatus wmsTaskStatus){
        TaskStatusRtn taskStatusRtn = new TaskStatusRtn();
        taskStatusRtn.setTaskId(wmsTaskId);
        taskStatusRtn.setTaskStatus(wmsTaskStatus.getTaskProgress());
        taskStatusRtn.setGridId(endGridId);
        taskStatusRtn.setReportTime(DateUtil.format(new Date(),DateUtil.YMDHMS));
        return taskStatusRtn;
    }

    public static TaskStatusRtn buildTaskStatusRtn(String wmsTaskId, WmsTaskStatus wmsTaskStatus, String reportInfo){
        TaskStatusRtn taskStatusRtn = new TaskStatusRtn();
        taskStatusRtn.setTaskId(wmsTaskId);
        taskStatusRtn.setTaskStatus(wmsTaskStatus.getTaskProgress());
        taskStatusRtn.setReportInfo(reportInfo);
        taskStatusRtn.setReportTime(DateUtil.format(new Date(),DateUtil.YMDHMS));
        return taskStatusRtn;
    }
}
